<?php $this->_extends('_layouts/main_layout'); ?>

<?php $this->_block('title'); ?>
<?php
if (!empty($_SESSION['ga_title']))
{
	echo $_SESSION['ga_title'];
	
}
else
{
	echo 'Free Games, Free Online Games, Free Online Casual Games with Cash Prizes - LaLaLoot Cash Prize Reels Game & Free Virtual Slot Machine Game';
}
?>
<?php $this->_endblock(); ?>

<?php $this->_block('keywords');?>
<meta name="keywords" content="<?php echo $site['keywords']; ?>" />

<?php $this->_endblock();?>

<?php $this->_block('description');?>
<meta name="description" content="LaLaLoot: one of the world's leading casual gaming communities with free cash reels game. Free online games with real cash prizes. Sign up and play today the LaLaLoot Virtual Slot Machine Game!" />
<?php $this->_endblock();?>

<?php $this->_block('content'); ?>
<?php if(!empty($x)):?>
<script src="<?php echo $js_url; ?>jquery.scrollTo-min.js" type="text/javascript" ></script>
<script type="text/javascript">
	window.innerHeight = 581;
	window.innerWidth = 800;
	window.moveTo(<?php echo $x;?>, <?php echo $y;?>);
	(function($){$(window).scrollTo({top:300,left:400});})(jQuery);
	window.location.hash = "game";
</script>
<?php endif;?>
<?php if(!empty($_SESSION['ga_title']) || !empty($user)): ?>
	<script type="text/javascript">
		$(function(){
			$('#main').removeClass('homebg').addClass('completeprofilebg');
		});
	</script>

	<div class="mt">
		<?php $this->_element('social');?>
	</div>
	<div class="mm createaccount">
	<?php if(!empty($_SESSION['ga_title'])):?>
		<div style="font-weight:700;font-size:16px;">
			<h3>Thank You! You Have Received Your 5 FREE Spins!</h3>
			<p>We have sent you a welcome e-mail. Please go to your mailbox, 
			complete your registration and receive another 5 spins today! To ensure you receive our emails in your inbox (not a bulk folder), add no-reply@lalaloot.co.uk to your address book.</p>
			<p>Now continue playing the game by spinning the slot below. When you run out of spins, participate in our sponsored offers
			to receive more spins. Good luck!</p>
		</div>
	<?php 
			unset($_SESSION['ga_title']);
		else:
	?>
		<?php if($user['credit']<1):?>
			<div class="title">You Have No Spins!</div>
				<hr width="740px" />
			<p style="font-weight:700;font-size:20px;margin-bottom:20">
				Get more spins now. You can get more spins by participating in the offers from our sponsors. Our sponsors help keep La La Loot 
				FREE and increase our jackpot every time someone in our community signs-up. Check out  <a href="<?php echo url('offer/morecredit'); ?>" style="color:white">Get More Spins</a>.
			</p>
		<?php else:?>
			<div class="title">Spin the slot now!</div>
				<hr width="740px" />
			<p style="font-weight:700;font-size:16px;margin-bottom:20" id="hint">
				You have spins! Each spin is a chance to win the jackpot and other prizes! When your account balance reaches £20, you can request a cash out. Keep playing and winning!
			</p>
		<?php endif;?>
	<?php endif;?>
		<div class="topad">
			<?php echo str_replace('[[USER_ID]]', $user['id'], $site['ad_top']);?>
		</div>
	</div>
	<div class="mb"></div>
	<div class="clear" style="height: 10px"></div>
<?php else: ?>
	<div class="clear" style="height:3px;"></div>
	<div id="congratulations">
		<?php $this->_element('social');?>
		<div class="clear"></div>
		<div class="playnow left white">
					<?php 
						if(empty($user) && isset($_SESSION['PLAYED'])):
					?>
					<div class="win1"><img width="307" height="285" alt="" src="<?php echo $img_url;?>win.png"></div>
					<?php else :?>
					<div class="clear"></div>
					
						<div class="win"><img src="<?php echo $img_url; ?>playnow.png" alt=""/></div>
						<div class="txt1">In this game, you can win cash<br />
							prizes everyday, it's FREE to play! <br />
							Get started by clicking below to<br />
							play NOW!
						</div>
					
					<?php endif;?>
		</div>
		<div class="join right white">
			<div class="clear" style="height:80px"></div>
			<div>1. Chance to win money!</div>
			<div>2. Have fun and join a community</div>
			<div>3. It's FREE</div>
			<div class="signup"><a href="<?php echo url('user/register'); ?>"><img src="<?php echo $img_url; ?>signup.png" alt="" width="138" height="51" /></a></div>
		</div>
		<div class="clear" style="height:25px;" id="separator"></div>
			<?php 
				if(empty($user) && isset($_SESSION['PLAYED'])):
			?>
			<div style="background-color:#1163C6;margin-left:-10px;width:795px;">
			 	<div class="txt white" style="font-size:18px;font-weight:700;padding: 10px">
					Create a FREE account to keep your £1.00 and to receive your next 5 FREE spins. Every spin is a chance to win more cash prizes.
				</div>
				<div style="text-align:center;padding-bottom:10px;">
					<a href="<?php echo url('user/register');?>">
						<img width="411" height="51" alt="" src="<?php echo $img_url; ?>createaccountbtn-1.png">
					</a>
				</div>
			</div>
			<?php endif;?>
	</div>
<?php endif;?>
	<div class="clear" style="height:10px;"></div>
	<div class="game" id="game">
	<?php $this->_element('slot_body');?>
	</div>
	<div class="social_tags" style="float:right;padding:20px 25px 0 0">
		<!--  facebook like button -->
		<div id="fb-root"></div>
		<script>(function(d, s, id) {
		  var js, fjs = d.getElementsByTagName(s)[0];
		  if (d.getElementById(id)) {return;}
		  js = d.createElement(s); js.id = id;
		  js.src = "//connect.facebook.net/en_US/all.js#appId=<?php echo $fbsocials['appId'];?>&xfbml=1";
		  fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));
		</script>
		<fb:like send="false" width="250" show_faces="false"></fb:like>
	</div>
	<div style="clear:both"></div>
	
	
	<?php if(isset($_SESSION[Q::ini('acl_session_key')]) && $user['credit']<1): ?>
		<script type="text/javascript">
			setTimeout("window.location.href ='<?php echo url('offer/morecredit');?>';", 10000);
		</script>
	<?php endif; ?>
	<!--  
		<script type="text/javascript" src="http://platform.linkedin.com/in.js">
			api_key: dmumlrnjb33v
		</script>
		
		<script type="IN/Share" data-counter="top"></script>
	-->

<script type="text/javascript">
function beforePlay(credit)
{
	$('#current_credits').html(credit);
}
function afterPlay(cash, credit, jackpot){
	loginned=<?php echo isset($user) ? 1 : 0;?>;
	if(loginned){
		changeCurrentUserState(cash, credit);
		if(credit==0){
			$('.have').hide();
			$('.title').fadeOut().html('You Have No Spins!').fadeIn('slow');
			$('#hint').fadeOut().html('Get more spins now. You can get more spins by participating in the offers from our sponsors. Our sponsors help keep La La Loot FREE and increases our jackpot every time someone in our community signs-up. Check out  <a href="<?php echo url('offer/morecredit'); ?>" style="color:white">Get More Spins</a>.').fadeIn('slow');
			$('#credit-tip').show();
		}
	}else{
		won1CreateNew();
	}
	changeJackpotState(jackpot);
}

function changeCurrentUserState(cash, credit){
	$('#current_balance').html('£'+cash);
	$('#current_credits').html(credit);
	$('#current_balance').animate({fontSize:"30px"}, 'slow').animate({fontSize:"12px"}, 'slow');
}

function won1CreateNew(){
	$('.playnow').children(':gt(0)').remove();
	$('#congratulations').animate({height:"40px"}, 'slow',  function(){
		var pic = '<div class="win1"><img width="307" height="285" alt="" src="<?php echo $img_url;?>win.png"></div>';
		$('.social').before(pic);
		var account = '<div style="background-color:#1163C6;margin-left:-10px;width:795px;"><div class="txt white" style="font-size:18px;font-weight:700;padding: 10px">Welecome to LaLaLoot. Create your FREE account to keep your £1.00 and continue playing our game. Register now and we will give you 5 spins. Every spin is a chance to win more cash prizes.</div><div style="text-align:center;padding-bottom:10px;position:relative;"><div id="reg-tip" style="width:<?php echo $tips['reg-tip']['tip_width']; ?>; position:absolute; left:190px; top:55px; border:solid 2px #FFF; background-color:<?php echo $tips['reg-tip']['bg_color']; ?>"><div style="color:#FFF; position:absolute; left:200px; top:-10px; font-size:16px;">◆</div><div style="color:<?php echo $tips['reg-tip']['bg_color']; ?>; position:absolute; left:200px; top:-8px; font-size:16px;">◆</div><p style="margin:<?php echo $tips['reg-tip']['tip_padding']; ?>; font-size:<?php echo $tips['reg-tip']['font_size']; ?>; color:<?php echo $tips['reg-tip']['font_size']; ?>; font-weight:bolder; line-height:<?php echo $tips['reg-tip']['tip_lineheight']; ?>; height:<?php echo $tips['reg-tip']['tip_height']; ?>; "><?php echo $tips['reg-tip']['tip_text']; ?></p></div><a href="<?php echo url("user/register");?>"><img width="411" height="51" alt="" src="<?php echo $img_url; ?>createaccountbtn-1.png"></a></div></div>';
		$('#separator').after(account);
		$('#new_account').hide().show('slow');
	});
	$('#congratulations').animate({height:"370px"}, 'slow');
}

function changeJackpotState(jackpot){
	var jackpotStr = jackpot.toFixed(2) + '';
	var jack = jackpotStr.split('.');
	$('.jackpot').children(':gt(0)').remove();
	var jPics = '';
	for(i=0;i<jack[0].length;i++){
		jPics += '<img alt="" src="img/' + jack[0][i] + '.png">';
	}
	jPics += '<img alt="" src="img/point.png">';
	for(i=0;i<jack[1].length;i++){
		jPics += '<img alt="" src="img/' + jack[1][i] + '.png">';
	}
	$('.jackpot').append(jPics);
}
</script>

<?php if (!empty($user)) {?>
<script type="text/javascript">
var PeanutLabsPre = (("https:" == document.location.protocol) ? "https://ssl-" : "http://");
document.write(unescape("%3Cscript src='" + PeanutLabsPre + "astatic.peanutlabs.com/js/alert/main.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var args = {
userId:"<?php echo $user['id'].'-4684-'.substr(md5($user['id'].'4684'.'7a023e4a695dd2735bdd3d407b575fea'), 0, 10 );?>", // Replace #userId# with your visitor's Peanut Labs userId
iframeURL:"http://www.lalaloot.co.uk/morecredit", // Replace with URL for where you've embedded IFRAME
position_ver:"bottom", //or "top"
position_hor:"right", //use left to show it on the left
hideTimer:"true"
};
peanut.initialize(args);
}
catch(e){}
</script>
<?php 
}
else
{?>
<?php }?>
<?php $this->_endblock('content'); ?>